<?php
namespace app\before\validate;

use think\Validate;

class ServiceBuy extends Validate
{
    protected $rule = [
        'buy_user' => 'require|number',
        'issue_id' => 'require|number',
        'foreign_key' => 'require|number',
        'service_type' => 'require',
        'order_no' => 'require',
        'tran_no' => 'require',
        'price' => 'require|number',
        'pay_type' => 'require',
        'pay_time' => 'require|number',
        'status' => 'require',
        'dashang' => 'require',
        'ds_price' => 'require|number',
        'ds_order_no' => 'require',
        'ds_tran_no' => 'require',
        'ds_pay_type' => 'require',
        'ds_pay_time' => 'require|number',
        'finish_time' => 'require|number',
        'add_time' => 'require|number',
    ];
    protected $message = [
        'buy_user.require' => '购买人ID为必填项',
        'buy_user.number' => '购买人ID需为数字',
        'issue_id.require' => '发布服务人id为必填项',
        'issue_id.number' => '发布服务人id需为数字',
        'foreign_key.require' => '服务ID为必填项',
        'foreign_key.number' => '服务ID需为数字',
        'service_type.require' => '服务方式   1：有偿  2：无偿为必填项',
        'order_no.require' => '内部订单号为必填项',
        'tran_no.require' => '交易号为必填项',
        'price.require' => '支付金额为必填项',
        'price.number' => '支付金额需为数字',
        'pay_type.require' => '支付方式  0：余额  1：微信  2：支付宝为必填项',
        'pay_time.require' => '支付时间为必填项',
        'pay_time.number' => '支付时间需为数字',
        'status.require' => '状态  0：未支付  1：已支付 2:已完成 3：已评价为必填项',
        'dashang.require' => '是否打赏  0：未打赏  1：已打赏为必填项',
        'ds_price.require' => '打赏金额为必填项',
        'ds_price.number' => '打赏金额需为数字',
        'ds_order_no.require' => '打赏订单编号为必填项',
        'ds_tran_no.require' => '打赏-交易号为必填项',
        'ds_pay_type.require' => '打赏-支付方式    0：余额  1：微信  2：支付宝为必填项',
        'ds_pay_time.require' => '打赏时间为必填项',
        'ds_pay_time.number' => '打赏时间需为数字',
        'finish_time.require' => '确认完成时间为必填项',
        'finish_time.number' => '确认完成时间需为数字',
        'add_time.require' => '下单时间为必填项',
        'add_time.number' => '下单时间需为数字',
    ];
    protected $scene = [
        'edit' => [
            'buy_user',
            'issue_id',
            'foreign_key',
            'service_type',
            'order_no',
            'tran_no',
            'price',
            'pay_type',
            'pay_time',
            'status',
            'dashang',
            'ds_price',
            'ds_order_no',
            'ds_tran_no',
            'ds_pay_type',
            'ds_pay_time',
            'finish_time',
            'add_time',
        ],
    ];
}
